import request from '@/utils/request'

/**
 * 消息中心 API
 */

// 分页查询消息列表
export const getMessagePage = (params: {
  current: number
  size: number
  type?: string
}) => {
  return request({
    url: '/message/page',
    method: 'get',
    params
  })
}

// 标记为已读
export const markMessageRead = (id: number) => {
  return request({
    url: `/message/read/${id}`,
    method: 'post'
  })
}

// 全部标记为已读
export const markAllRead = () => {
  return request({
    url: '/message/readAll',
    method: 'post'
  })
}

// 删除消息
export const deleteMessage = (id: number) => {
  return request({
    url: `/message/${id}`,
    method: 'delete'
  })
}

// 获取未读数量
export const getUnreadCount = () => {
  return request({
    url: '/message/unreadCount',
    method: 'get'
  })
}

// 获取统计数据
export const getMessageStatistics = () => {
  return request({
    url: '/message/statistics',
    method: 'get'
  })
}

